package cvc.sync;

public class Capturer implements Runnable {

	int imageGrabbed = 0;

	void grabImage() {
		synchronized (this) {
			imageGrabbed++;
		}
	}

	void getImage(Holder<Integer> conteiner) {
		synchronized (this) {
			conteiner.value = imageGrabbed;
		}
	}

	@Override
	public void run() {

		while (true) {

			grabImage();
			System.out.println(this.getClass().getName());

			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				// TODO: handle exception
			}
		}

	}
}
